<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="/WEB-INF/tlds/spring.tld"%>
<%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld"%>
<c:set var="BasePath" value="${pageContext.request.contextPath}"></c:set>
<c:set var="ResPath" value="${pageContext.request.contextPath}/res"></c:set>
<c:set var="Plugins" value="${pageContext.request.contextPath}/res/plugins"></c:set>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>海航通信ERP系统</title>
<link href="${Plugins}/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="${BasePath}/res/images/hna_logo_1.png" type="image/x-icon" />
<script src="${Plugins}/jquery/jquery-1.3.2.min.js"	type="text/javascript"></script>
<script src="${Plugins}/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script src="${BasePath}/res/system/menuData.js" type="text/javascript"></script>
<!-- custom css -->
<style type="text/css"> 
	body,html{height:100%;}
	body{ padding:0px; margin:0;   overflow:hidden;}  
	.l-link{ display:block; height:26px; line-height:26px; padding-left:10px; text-decoration:underline; color:#333;}
	.l-link2{text-decoration:underline; color:white; margin-left:2px;margin-right:2px;}
	.l-layout-top{background:#102A49; color:White;}
	.l-layout-bottom{ background:#E5EDEF; text-align:center;}
	#pageloading{position:absolute; left:0px; top:0px; background:white url('${ResPath}/demo/loading.gif') no-repeat center; width:100%; height:100%;z-index:99999;}
	.l-link{ display:block; line-height:22px; height:22px; padding-left:16px;border:1px solid white; margin:4px;}
	.l-link-over{ background:#FFEEAC; border:1px solid #DB9F00;} 
	.l-winbar{ background:#2B5A76; height:30px; position:absolute; left:0px; bottom:0px; width:100%; z-index:99999;}
	.space{ color:#E7E7E7;}
	/* topmenu */
	.l-topmenu{ margin:0; padding:0; height:31px; line-height:31px; background:url('${ResPath}/demo/top.jpg') repeat-x bottom;  position:relative; border-top:1px solid #1D438B;  }
	.l-topmenu-logo{ color:#E7E7E7; padding-left:35px; line-height:26px;background:url('${BasePath}/res/images/hna_logo_1.png') no-repeat 10px 4px;}
	.l-topmenu-welcome{  position:absolute; height:24px; line-height:24px;  right:30px; top:2px;color:#070A0C;}
	.l-topmenu-welcome a{ color:#E7E7E7; text-decoration:underline}
	/*bottom tip dialog*/
	.l-dialog-win .l-dialog-content{font-size: 14px;background-color: rgb(248, 248, 236);padding-top:10px;} 
 </style>
</head>
<body style="padding: 0px; background: #EAEEF5;">
	<div id="pageloading"></div>
	<%@include file="header.jsp" %>
	<!-- start of main -->
	<div id="layout1" style="width:99.2%; margin:0 auto; margin-top:4px; ">
        <div position="left" id="accordion1"> 
            <div title="功能列表" class="l-scroll">
                <ul id="tree1" style="margin-top:3px;"></ul>
			</div>
        </div>
        <div position="center" id="framecenter">
            <div tabid="home" title="我的主页" style="height:300px">
                <!-- <iframe frameborder="0" name="home" id="home" src="${ResPath}/demo/welcome.jsp"></iframe> -->
                <iframe frameborder="0" name="home" id="home" src="${BasePath}/manager/system/main/welcome.do"></iframe>
            </div> 
        </div> 
    </div>
    <!-- start of footer -->
    <div style="height:32px; line-height:32px; text-align:center;">
            海航通信有限公司 版权所有
    </div>
    <div style="display:none"></div>
    <script type="text/javascript">
	var tab = null;
	var accordion = null;
	var tree = null;
	$(function ()
	{
	    //布局
	    $("#layout1").ligerLayout({ leftWidth: 220, height: '100%',heightDiff:-34,space:4, onHeightChanged: f_heightChanged });
	    var height = $(".l-layout-center").height();
	    //Tab
	    $("#framecenter").ligerTab({ height: height });
	    //面板
	    $("#accordion1").ligerAccordion({ height: height - 24, speed: null });
	    $(".l-link").hover(function ()
	    {
	        $(this).addClass("l-link-over");
	    }, function ()
	    {
	        $(this).removeClass("l-link-over");
	    });
	   var time = new Date().getTime();
	    //树
	    $("#tree1").ligerTree({
	        url: "loadOwnTree.do?sessionId=" + time,
	        checkbox: false,
	        slide: false,
	        nodeWidth: 120,
	        attribute: ['nodename', 'menuUrl', 'tabid'],
	        btnClickToToggleOnly: false,
	        onSelect: function (node)
	        {
	            if (!node.data.menuUrl) return;
	            var tabid = $(node.target).attr("tabid");
	            if (!tabid) {
	                tabid = new Date().getTime();
	                $(node.target).attr("tabid", tabid)
	            }
	            //若已经存在，则刷新；否则，增加
	            tab.isTabItemExist(tabid) ? f_reflashTab(tabid) : f_addTab(tabid, node.data.text, node.data.menuUrl);
	        },
	        onSuccess:function(){
	    	    this.expandAll();
	        }
	    });
	    $('.l-tree-icon-folder-open').removeClass('l-tree-icon-folder-open').addClass('l-tree-icon-folder');//fix tree floder collapse bug
		//hook
	    tab = $("#framecenter").ligerGetTabManager();
	    accordion = $("#accordion1").ligerGetAccordionManager();
	    tree = $("#tree1").ligerGetTreeManager();
	    $("#pageloading").hide();
	});
	function f_heightChanged(options)
	{
	    if (tab)
	        tab.addHeight(options.diff);
	    if (accordion && options.middleHeight - 24 > 0)
	        accordion.setHeight(options.middleHeight - 24);
	}
	function f_getWhere()
    {
        if (!grid) return null;
        var clause = function (rowdata, rowindex)
        {
            var key = $("#txtKey").val();
            return rowdata.CustomerID.indexOf(key) > -1;
        };
        return clause; 
    }
	//tab function
	function f_addTab(tabid,text, url)
	{   
		if(tab.isTabItemExist(tabid)){
			tab.selectTabItem(tabid);
			tab.removeSelectedTabItem();
			tab.addTabItem({ tabid : tabid,text: text, url: url });
		}else{
	    	tab.addTabItem({ tabid : tabid,text: text, url: url });
		}
	}
	function f_removeTab(tabid){
		tab.removeTabItem(tabid);
	}
	function f_reflashTab(tabid){
		tab.selectTabItem(tabid);
		tab.reload(tabid);
	}
	//相同tab的标题保持只有一个
	function f_overTab(text, url){
		var tabid = _getTabidByText(text);
		if(tabid){
			tab.removeSelectedTabItem();
			tab.overrideTabItem({'tabid': tabid, 'text': text, 'url': url});
		}else{
			tab.overrideSelectedTabItem({'text': text, 'url': url});
		}
	}
	function _getTabidByText(text){
		var tabs = tab.getTabidList();
		for(var i=0;i<tabs.length;i++){
			var tabtext = $('li[tabid="'+tabs[i]+'"]').find('a').text();
			console.log(tabtext);
			if(text === tabtext){
				return tabs[i];
			}
		}
	}
	//dialog function
	var F_TIP;
	function f_tip(context){
		if (!F_TIP) {
			F_TIP = $.ligerDialog.tip({ title: '提示信息', content: context });
		}
		else {
		    var visabled = F_TIP.get('visible');
		    if (!visabled) F_TIP.show();
		    F_TIP.set('content', context);
		}
		setTimeout(function(){
			F_TIP.hidden();
		}, 5000);
	}
	</script> 
</body>
</html>